package com.wzh.house.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.wzh.house.entity.RentLogEntity;
import com.wzh.house.service.RentLogService;
import com.wzh.common.utils.PageUtils;
import com.wzh.common.utils.R;



/**
 * 
 *
 * @author wzh
 * @email 1281204121@qq.com
 * @date 2022-03-22 19:04:17
 */
@RestController
@RequestMapping("house/rentlog")
public class RentLogController {
    @Autowired
    private RentLogService rentLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = rentLogService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{rentLogId}")
    public R info(@PathVariable("rentLogId") Integer rentLogId){
		RentLogEntity rentLog = rentLogService.getById(rentLogId);

        return R.ok().put("rentLog", rentLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody RentLogEntity rentLog){
		rentLogService.save(rentLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody RentLogEntity rentLog){
		rentLogService.updateById(rentLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] rentLogIds){
		rentLogService.removeByIds(Arrays.asList(rentLogIds));

        return R.ok();
    }

}
